package io;

import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.nio.CharBuffer;

/**
 * Created with IntelliJ IDEA.
 * Description: 字符流 read 一个字符
 * User: Li_yizYa
 * Date: 2025/5/8
 * Time: 17:16
 */
public class Demo13 {
    /**
     * reader 一次读取一个字符
     * @param args
     */
    public static void main(String[] args) {
        try (Reader reader = new FileReader("./test.txt")) {
            while (true) {
                int c = reader.read();
                if (c == -1) {
                    break;
                }
                char ch = (char)c;
                System.out.println(ch);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
